#coding:utf-8
from Comm.webdriver_base import WebDriverBase
import time
from Comm.Log import LogUtil
from selenium.webdriver.common.by import By

logger = LogUtil("BugGoods").get_logger()

class BugGoods(WebDriverBase):

    def bugphysicalgoods(self):
        #点击轻喜优品
        self.loc_method(".uni-tabbar__item:nth-child(4) img", "click", method='CSS_SELECTOR')
        #选择商品
        self.driver.find_element(By.CSS_SELECTOR, ".goods-item:nth-child(3) img").click()
        #点击立即购买
        self.loc_method(".detail_bot:nth-child(3) .buy-price", "click", method='CSS_SELECTOR')
        # 选择余额支付
        self.driver.find_element(By.CSS_SELECTOR, ".box-between:nth-child(4) img").click()
        #点击立即支付
        self.loc_method(".bottom-right-text > span", "click", method='CSS_SELECTOR')
        #点击返回首页
        self.loc_method(".inBtn:nth-child(2)", "click", method='CSS_SELECTOR')

    def bugservicegoods(self):
        #选择商品
        self.driver.find_element(By.CSS_SELECTOR, "#venue4 .goods-item:nth-child(3) img").click()
        time.sleep(1)
        #点击立即购买
        self.loc_method(".detail_bot:nth-child(3) .btn_3 > .buy-price", "click", method='CSS_SELECTOR')
        #点击确定
        self.loc_method(".animation-fade > .shop_btn", "click", method='CSS_SELECTOR')
        time.sleep(1)
        #选择余额支付
        self.driver.find_element(By.CSS_SELECTOR, ".box-between:nth-child(3) img").click()
        #点击立即支付
        self.loc_method(".bottom-right-text > span", "click", method='CSS_SELECTOR')
